<?php
$file = $DB->db_query_first("select * from res_file where id=".$INCOME['id']);
if($file && $file['isPost']==1 && $file['canDown']==1)
{
	if($INCOME['op']=="st")
	{
		$DB->db_query("insert log_down(fid,size,addTime,uid,uname)values('".$file['id']."','".$file['size']."','".$gCurTime."','".$_SESSION['adminUser']['id']."','".$_SESSION['adminUser']['name']."')");
	    exit;
	}
	if($file['yunDownUrl'])
	{
        $name = basename($file['yunDownUrl']);
		echo "<script>window.location.href='".$file['yunDownUrl']."';</script>";
	}
	else
	{
	include "lib/FileDownload.class.php";
	$down = new FileDownload();
	$flag = $down->download(str_replace("s.",".",$file['path']),$file['fid'].".".$file['ext']);
	//$flag = $obj->download($file, $name, true); // 断点续传

	if(!$flag){
    	echo 'file not exists';
	}
	}
}
else
{
	echo 'file not exists';
}
?>